package org.example.shop_db.service.Impl;

import org.apache.ibatis.annotations.Insert;
import org.example.shop_db.mapper.ProductMapper;
import org.example.shop_db.pojo.Product;
import org.example.shop_db.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service
public class ProductServiceImpl implements ProductService {

@Autowired
private ProductMapper productMapper;

    @Override
    public boolean add(Product product) {
        Integer i = productMapper.findByName(product.getName());
        if (i == null) {
            productMapper.add(product);
            return true;
        }else {
            return false;
        }

    }
}
